import hou

def createKeys(key_frame):
    data = key_frame
    fps = hou.fps()
    keymap_obj = hou.node('/obj').createNode("geo", "KeyMap")
    keymap_obj.setColor(hou.Color(0, 255, 0))

    offset = 0
    for key, values in data.items():
        font = keymap_obj.createNode('font', key)
        font.parm('text').set(key)
        font_pos = font.position()
        color = keymap_obj.createNode('color', key)
        color.setPosition(hou.Vector2(font_pos.x(), font_pos.y() - 1))
        color.setInput(0, font)
        transform = keymap_obj.createNode('xform')
        transform.parm('tx').set(offset)
        transform.setPosition(hou.Vector2(font_pos.x(), font_pos.y() - 2))
        transform.setInput(0, color)

        parms = color.parmTuple('color')

        start_list = values['start']
        end_list = values['end']

        for i in range(len(start_list)):
            color.parmTuple('color').set((0, 0, 0))
            skf = hou.Keyframe()
            skf.setValue(1)
            skf.setFrame(int(start_list[i] * fps))

            ekf = hou.Keyframe()
            ekf.setValue(1)
            ekf.setFrame(int(end_list[i] * fps))

            # before start frame
            b_skf = hou.Keyframe()
            b_skf.setValue(0)
            b_skf.setFrame(int(start_list[i] * fps) - 1)

            # after end frame
            a_ekf = hou.Keyframe()
            a_ekf.setValue(0)
            a_ekf.setFrame(int(end_list[i] * fps) + 1)

            parms.setKeyframe((b_skf, b_skf, b_skf))
            parms.setKeyframe((skf, skf, skf))
            parms.setKeyframe((ekf, ekf, ekf))
            parms.setKeyframe((a_ekf, a_ekf, a_ekf))

        offset += 1